package com.finance.system.accountbook.service;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.finance.system.accountbook.entity.CashRecordEntity;
import com.finance.system.support.bean.OffsetQuery;
import com.finance.system.support.bean.OffsetResult;
import com.finance.system.support.bean.ResultBean;
import com.finance.system.accountbook.entity.CashRecordInbound;
import com.finance.system.accountbook.entity.CashRecordOutbound;
import com.finance.system.support.IBaseService;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 消费记录表，存放每笔消费的信息 服务类
 * </p>
 *
 * @author whdong
 * @since 2019-12-24
 */
public interface ICashRecordService extends IBaseService<CashRecordEntity> {
    /**
     * 新增一条交易记录
     * @param cashRecord
     */
    ResultBean<CashRecordEntity> addOneRecord(CashRecordInbound cashRecord);

    /**
     * 根据id获取交易记录
     * @param id
     * @return
     */
    ResultBean<CashRecordOutbound> getRecordById(String id);

    /**
     * 交易记录更新
     * @param cashRecord
     * @return
     */
    ResultBean<CashRecordEntity> modifyById(CashRecordInbound cashRecord);
    void removeById(String id);
    OffsetResult<CashRecordOutbound> getByCondition(CashRecordInbound cashRecord,
                                                    OffsetQuery<CashRecordEntity> offsetQuery);



    /**
     *  条件查询某个账本的记录
     * @param record
     * @return
     */
    OffsetResult<CashRecordOutbound> getPageDataByGroup(CashRecordInbound record,
                                                        OffsetQuery<CashRecordEntity> offsetQuery);

    /**
     *  统计某个账本的支出明细
     * @param record
     * @return
     */
    ResultBean<Map<String,Object>> getSpendingStatisticsByGroup(CashRecordInbound record,
                                                                OffsetQuery<CashRecordEntity> offsetQuery);

    /**
     * 对统计的数据进行结算
     * @param record
     * @return
     */
    ResultBean closeRecordOfSpendingStatisticsByGroup(CashRecordInbound record);

    OffsetResult<CashRecordEntity> getListByCondition(CashRecordInbound record,
                                                                                       OffsetQuery offsetQuery);

    List<CashRecordOutbound> listByCondition(CashRecordInbound record);
    void modifyByWrapper(UpdateWrapper<CashRecordEntity> example, CashRecordEntity record);

}
